<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/jspf/must/basePath.jspf" %>
<!--后台UI组件Start-->
<%@include file="/WEB-INF/jspf/zj/ligerui/LigerUI.jspf" %>
<%--<%@include file="/WEB-INF/jspf/zj/ligerui/LigerUI_form.jspf" %>--%>
<!--后台UI组件End-->
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <script type="text/javascript">
//-------------------------------全局变量-------------------------------------------------
            var UPDATE;
            var GRID, GRID2;
            var ADD;
            $(function() {
                GRID = $("#divID_GRID").ligerGrid({
                    columns: [
                        {display: '订单号', name: 'order_code', width: 100, align: 'left'}
                        , {display: '房间', name: 'room_code', width: 40, align: 'left'}
                        , {display: '开单时间', name: 'order_time', width: 111, align: 'left'}
                        , {display: '金额', name: 'order_sumprice', width: 171, align: 'left', totalSummary: {type: 'sum'}}
                        , {display: '开单人', name: 'user_account', width: 61, align: 'left'}
                        , {display: '状态', name: 'order_sort', width: 37, align: 'left', render: function(data) {
                                switch (data.order_sort) {
                                    case "0":
                                        return "<h5>待付</h5>";
                                    case "1":
                                        return "已付";
                                    case "2":
                                        return "开立";
                                }
                            }}
                        , {display: '打印次数', name: 'order_print', width: 42, align: 'left'}
                        , {display: 'id', name: 'order_id', hide: true}
                    ]
                    , usePager: true
                    , pageSizeOptions: [50, 100, 200, 500, 1000]
                    , pageSize: 100
                    , url: 'view/buy/order/manager/fwy/r/reportFWY.imy'
                    , width: '620'
                    , height: '100%'
                    , detail: {onShowDetail: f_showOrderB}
//                    , onSelectRow: f_viewOrderB
                });
                function f_showOrderB(row, detailPanel, callback) {
                    var grid = document.createElement('div');
                    $(detailPanel).append(grid);
                    $(grid).css('margin', 10).ligerGrid({
                        columns: [
                            {display: '类型', name: 'source_sort', width: 37, align: 'left', render: function(data) {
                                    switch (data.source_sort) {
                                        case "1":
                                            return "菜谱";
                                        case "2":
                                            return "活动";
                                        case "3":
                                            return "套餐";
                                    }
                                }}
                            , {display: '菜名', name: 'buy_name', width: 90, align: 'left'}
                            , {display: '价格', name: 'buy_price', width: 40, align: 'left'}
                            , {display: '数量', name: 'buy_number', width: 30, align: 'left'}
                            , {display: '上台数量', name: 'orderb_lock_number', width: 30, align: 'left'}
                            , {display: '总额', name: 'buy_sum', width: 90, align: 'left', totalSummary: {type: 'sum'}}
                            , {display: '状态', name: 'orderb_style', width: 36, align: 'left', render: function(data) {
                                    switch (data.orderb_style) {
                                        case 1:
                                            return "未定";
                                        case 2:
                                            return "锁定";
                                        case 3:
                                            return "制作";
                                        case 4:
                                            return "完结";
                                    }
                                    return data.orderb_style;
                                }}
                            , {display: 'id', name: 'orderb_id', hide: true}
                        ]
                        , usePager: false
                        , url: 'view/buy/order/manager/fwy/s/selectOneB.imy?order_id=' + row.order_id
                        , width: '485'
                        , height: '100%'
                    });
                }
            });

//-------------------------------GRID列函数-----------------------------------------------
            function printOrder(id) {

            }
            /**
             * 当日单据 nowDD
             * @returns void
             */
            function f_tj_nowdd() {
                f_GRID_tj_ToNull();
                GRID.setParm("index", 0);
                GRID.reload();
            }
            function f_tj_myorder() {
                f_GRID_tj_ToNull();
                GRID.setParm("index", 1);
                GRID.setParm("code", $("#ID_order_code").val());
                GRID.reload();
            }

            function f_tj_MySelect() {
                f_GRID_tj_ToNull();
                GRID.setParm("index", 2);//游标
                GRID.setParm("room", $("#ID_room_code").val());//房间编号
                GRID.setParm("date1", $("#ID_order_date1").val());//时间范围-开始
                GRID.setParm("date2", $("#ID_order_date2").val());//时间范围-结束
                GRID.setParm("sort", $("#ID_order_sort").val());//类型
                GRID.reload();
            }

            function f_GRID_tj_ToNull() {
                GRID.removeParm("index");//游标
                GRID.removeParm("code");//订单编号
                GRID.removeParm("room");//房间编号
                GRID.removeParm("date1");//时间范围-开始
                GRID.removeParm("date2");//时间范围-结束
                GRID.removeParm("sort");//类型
            }
            function f_tj_ToNull() {
                $("#ID_room_code").val("");
                $("#ID_order_date1").val("");
                $("#ID_order_date2").val("");
                $("#ID_order_code").val("");
            }
        </script>
    </head>
    <body>
        <div style="float: left; margin-left: 3px;">
            <div id="divID_GRID"></div>
        </div>
        <div style="margin: 10px;">
            <p>//温柔提醒：默认展示当日开的数据。</p>
            <p>//如果要查阅其他时间段的数据，请在下设置条件，并查询。</p>
            <hr/>
        </div>
        <div id="divID_Select" style="margin: 5px;">
            <div style="margin-top: 10px;">
                <button onclick="f_tj_nowdd();">当日订单</button>
            </div>
            <div style="margin-top: 10px;"><button onclick="f_tj_myorder()">指定订单：</button><input id="ID_order_code"  size="9" type="text" ></div>
            <div style="margin-top: 10px;">
                <table>
                    <tr><td>状态</td>
                        <td>
                            <select id="ID_order_sort" name="sort">
                                <option value="1">结账</option>
                                <option value="0">待付</option>
                                <option value="2">开立</option>
                                <option value="3" selected>所有</option>
                            </select>
                        </td>
                    </tr>
                    <tr><td>房间</td><td><input id="ID_room_code"  size="9"  type="text" ></td></tr>
                    <tr><td>时间</td><td><input id="ID_order_date1"  size="9" type="date" >-<input id="ID_order_date2"  size="9" type="date" ></td><tr>
                    <tr><td></td><td><button onclick="f_tj_ToNull();">清空条件</button>,<button onclick="f_tj_MySelect();">查询</button></td></tr>
                </table>
            </div>
        </div>
    </body>
</html>
